package com.battle.service.repository.in;

import com.battle.pojo.dto.authorization.GetAuthorizedByTargetIdDto;
import com.battle.pojo.entity.Authorization;
import com.battle.pojo.enums.authorized.AuthorizedTypeEnum;
import nirvana.core.repository.IRepository;

import java.util.List;
import java.util.Map;

/**
 * 【描 述】：
 * 【环 境】：J2SE
 * 【详 细】：
 *
 */
public interface AuthorizationRepository extends IRepository<Authorization> {


    /**
     * 获取对象的可用资源汇总
     * @param targetIds
     * @return
     */
    List<Long> getAvailableResourceByTargetIds(List<Long> targetIds);


    /**
     * 清空授权
     * @param targetId
     * @param type
     */
    void clear(Long targetId, AuthorizedTypeEnum type);

    /**
     * 获取对象的授权map
     * @param dto
     * @return
     */
    Map<Long,Integer> getAuthorizedMap(GetAuthorizedByTargetIdDto dto);


    /**
     * 批量移除授权
     * @param targetIds
     */
    void bathRemoveTargetAuthorized(List<Long> targetIds);


    /**
     * 获取权限
     * @param dto
     * @return
     */
    List<Long> getTargetAuthorizedList(GetAuthorizedByTargetIdDto dto);
}